package com.qf.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qf.pojo.DtsOrder;
import com.qf.vo.OrderIdAndGoods;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 订单表 Mapper 接口
 * </p>
 *
 * @author zhaojian
 * @since 2021-05-12
 */
public interface DtsOrderMapper extends BaseMapper<DtsOrder> {

    @Select("SELECT  DATE_FORMAT(add_time,'%Y-%m-%d') AS `day`,SUM(order_price) AS amount,COUNT(1) AS `orders`,COUNT(1) AS products FROM dts_order WHERE add_time > DATE_SUB(DATE_FORMAT('2119-12-01','%Y-%m-%d'),INTERVAL #{day} DAY) GROUP BY DAY")
    List<OrderIdAndGoods> findGoodsOrder(int i);
}
